
#include "PresentationParameters.h"
#include "../GraphicsDeviceManager.h"

using namespace Riccsson::Xna::Framework::Graphics;
using namespace Riccsson::Xna::Framework;

#pragma region Constructors

PresentationParameters::PresentationParameters()
	: backBufferHeight( GraphicsDeviceManager::DefaultBackBufferHeight )
	, backBufferWidth( GraphicsDeviceManager::DefaultBackBufferWidth )

	, PROP3_INIT(PresentationParameters, BackBufferFormat)
	, PROP3_INIT(PresentationParameters, BackBufferHeight)
	, PROP3_INIT(PresentationParameters, BackBufferWidth)
	, PROP3_INIT(PresentationParameters, Bounds)
	, PROP3_INIT(PresentationParameters, DeviceWindowHandle)
	, PROP3_INIT(PresentationParameters, DepthStencilFormat)
	, PROP3_INIT(PresentationParameters, IsFullScreen)
	, PROP3_INIT(PresentationParameters, MultiSampleCount)
{
	Clear();
}

PresentationParameters::~PresentationParameters()
{
	Dispose(false);
}

#pragma endregion Constructors

#pragma region Properties

PROP3_GET_CPP(PresentationParameters, SurfaceFormat, BackBufferFormat)
{
	return backBufferFormat;
}
PROP3_SET_CPP(PresentationParameters, SurfaceFormat, BackBufferFormat)
{
	backBufferFormat = value;
}

PROP3_GET_CPP(PresentationParameters, int, BackBufferHeight)
{
	return backBufferHeight;
}
PROP3_SET_CPP(PresentationParameters, int, BackBufferHeight)
{
	backBufferHeight = value;
}

PROP3_GET_CPP(PresentationParameters, int, BackBufferWidth)
{
	return backBufferWidth;
}
PROP3_SET_CPP(PresentationParameters, int, BackBufferWidth)
{
	backBufferWidth = value;
}

PROP3_GET_CPP(PresentationParameters, Riccsson::Xna::Framework::Rectangle, Bounds)
{
	return Riccsson::Xna::Framework::Rectangle(0, 0, backBufferWidth, backBufferHeight);
}

PROP3_GET_CPP(PresentationParameters, Riccsson::System::IntPtr, DeviceWindowHandle)
{
	return deviceWindowHandle;
}
PROP3_SET_CPP(PresentationParameters, Riccsson::System::IntPtr, DeviceWindowHandle)
{
	deviceWindowHandle = value;
}

#if WINDOWS_STOREAPP
SwapChainBackgroundPanel SwapChainPanel { get; set; }
#endif

PROP3_GET_CPP(PresentationParameters, DepthFormat, DepthStencilFormat)
{
	return depthStencilFormat;
}
PROP3_SET_CPP(PresentationParameters, DepthFormat, DepthStencilFormat)
{
	depthStencilFormat = value;
}

PROP3_GET_CPP(PresentationParameters, bool, IsFullScreen)
{
#if WINRT
		// Always return true for Windows 8
		return true;
#else
			return isFullScreen;
#endif
}
PROP3_SET_CPP(PresentationParameters, bool, IsFullScreen)
{
	throw;
}
		
PROP3_GET_CPP(PresentationParameters, int, MultiSampleCount)
{
	return multiSampleCount;
}
PROP3_SET_CPP(PresentationParameters, int, MultiSampleCount)
{
	multiSampleCount = value;
}

#pragma endregion Properties


#pragma region Methods

void PresentationParameters::Clear()
{
	throw;
}

GC_PTR<PresentationParameters> PresentationParameters::Clone()
{
	GC_PTR<PresentationParameters> clone = GC_PTR<PresentationParameters>(new PresentationParameters());
	clone->backBufferFormat = this->backBufferFormat;
	clone->backBufferHeight = this->backBufferHeight;
	clone->backBufferWidth = this->backBufferWidth;
	clone->deviceWindowHandle = this->deviceWindowHandle;
	clone->disposed = this->disposed;
	clone->IsFullScreen = this->IsFullScreen;
	clone->depthStencilFormat = this->depthStencilFormat;
	clone->multiSampleCount = this->multiSampleCount;
	clone->PresentationInterval = this->PresentationInterval;
	clone->displayOrientation = this->displayOrientation;
	return clone;
}

void PresentationParameters::Dispose()
{
	throw;
}

void PresentationParameters::Dispose(bool disposing)
{
	if (!disposed)
	{
		disposed = true;
		if (disposing)
		{
			// Dispose managed resources
		}
		// Dispose unmanaged resources
	}
}

#pragma endregion Methods